<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<ui:composition template="../template/layout.xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	<ui:param name="pageHeaderTitle" value="View treatment act" />
	<ui:define name="content">
		<br />
		<h2 style="text-align: center">Treatment act</h2>
		<h3 style="text-align: center">#{viewTreatmentActBean.treatmentAct.client.firstName}
			#{viewTreatmentActBean.treatmentAct.client.lastName}</h3>
		<div id="inner_content" style="padding-top:10px">
			<h:form>
				<h:panelGrid columns="3" cellpadding="4" styleClass="viewClientGrid"
					columnClasses="viewClientGridColumn1, viewClientGridColumn2, viewClientGridColumn3">

					<h:panelGroup>
						<p:outputLabel value="Date of appeal: " style="font-weight:bold" />
					</h:panelGroup>

					<h:panelGroup>
						<h:outputText
							value="#{viewTreatmentActBean.treatmentAct.appealDate}"
							converter="stringToCalendarConverterNoTime" />
					</h:panelGroup>

					<h:panelGroup>
					</h:panelGroup>

					<h:panelGroup>
						<p:outputLabel value="Symptoms: " style="font-weight:bold" />
					</h:panelGroup>

					<h:panelGroup>
						<h:outputText
							value="#{viewTreatmentActBean.treatmentAct.symptoms}" styleClass="infoText" />
					</h:panelGroup>

					<h:panelGroup>
					</h:panelGroup>

					<h:panelGroup>
						<p:outputLabel value="Diagnosis: " style="font-weight:bold" for="diagnosisDoc" />
					</h:panelGroup>

					<h:panelGroup
						rendered="#{request.isUserInRole('Receptionist') and not request.isUserInRole('Doctor')}">
						<h:outputText id="diagnosisRec"
							value="#{viewTreatmentActBean.treatmentAct.diagnosis}" />
					</h:panelGroup>

					<h:panelGroup rendered="#{request.isUserInRole('Doctor')}">
						<p:inputText id="diagnosisDoc"
							value="#{viewTreatmentActBean.treatmentAct.diagnosis}" maxlength="30"/>
					</h:panelGroup>

					<h:panelGroup>
					</h:panelGroup>

					<h:panelGroup rendered="#{request.isUserInRole('Receptionist')}">
						<p:outputLabel value="Paid status: " style="font-weight:bold" />
					</h:panelGroup>

					<h:panelGroup rendered="#{request.isUserInRole('Receptionist')}">
						<p:selectOneMenu panelStyle="width:150px"
							converter="stringToStatusConverter" style="width:160px"
							value="#{viewTreatmentActBean.treatmentAct.paidStatus}">
							<f:selectItem itemLabel="Yes" itemValue="#{true}" />
							<f:selectItem itemLabel="No" itemValue="#{false}" />
						</p:selectOneMenu>						
					</h:panelGroup>

					<h:panelGroup rendered="#{request.isUserInRole('Receptionist')}">
					</h:panelGroup>

					<h:panelGroup>
						<p:outputLabel value="Doctors involved: " style="font-weight:bold" />
					</h:panelGroup>

					<h:panelGroup>
						<h:outputText value="#{viewTreatmentActBean.getInvolvedDoctors()}" />
					</h:panelGroup>

					<h:panelGroup>
					</h:panelGroup>

					<h:panelGroup>
						<br />
						<p:commandButton value="Save"
							action="#{viewTreatmentActBean.updateAct()}" style="width: 95px"
							styleClass="pCommandButton" update=":menu_info" />
					</h:panelGroup>				

				</h:panelGrid>
			</h:form>
			<h:panelGroup rendered="#{request.isUserInRole('Receptionist')}" >
				<h:form>

					<p:commandButton value="Delete"
							onclick="confirmation.show();return false;" style="margin-left: 57px; margin-top: 4px" styleClass="pDeleteButton" />

					<p:confirmDialog message="Are you sure want to delete act?"
						widgetVar="confirmation">
						<p:commandButton value="Yes" onclick="confirmation.hide()"
							actionListener="#{viewTreatmentActBean.deleteAct}">
						</p:commandButton>
						<p:commandButton value="No" onclick="confirmation.hide()"
							type="button" />
					</p:confirmDialog>

				</h:form>
			</h:panelGroup>			
			<br />
			<h:outputLink value="createTreatmentRequest.xhtml"
				style="margin-left: 58px;"
				rendered="#{request.isUserInRole('Receptionist')}">
				<h:outputText value="Create treatment request" />
				<f:param name="actId"
					value="#{viewTreatmentActBean.treatmentAct.id}" />
			</h:outputLink>						
		</div>
		<br />
		<h:panelGroup id="menu_info" layout="block" style="width: 300px">
			<p:messages />
		</h:panelGroup>
	</ui:define>
	<ui:define name="footer">
		<ui:param name="navBean" value="#{viewTreatmentActBean}" />
		<ui:param name="navAction" value="goBack" />
		<ui:param name="navTitle" value="Back" />
		<ui:include src="/template/footer_bean_navigation.xhtml" />
	</ui:define>
</ui:composition>
</html>